<?php if($this->session->userdata('logged_in')) : ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>.: BooMS v1.0 :.</title>
<link type="text/css" rel="stylesheet" href="<?php echo base_url(); ?>/css/reset.css" />
<link type="text/css" rel="stylesheet" href="<?php echo base_url(); ?>/css/960.css" />
<link type="text/css" rel="stylesheet" href="<?php echo base_url(); ?>/css/main.css" />
<link type="text/css" rel="stylesheet" href="<?php echo base_url(); ?>/css/datepicker.css" />
<script type="text/javascript" src="<?php echo base_url(); ?>/js/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/datepicker.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/tinymce/jscripts/tiny_mce/jquery.tinymce.js"></script>

</head>

<body>

<div id="wrap">
	<div id="top">
        <div id="globalNavigation">
        	<div id="user">
            	<ul>
                	<li><a href="#">Change info</a></li>
                    <li><a href="<?php echo site_url().'/gafs/logout'; ?>">Log out</a></li>
                </ul>
            </div>
        	<div id="logo">
            	<h1>BooMS</h1>
                <p><em>Boo's website content management</em></p>
            </div>
        	<div id="menu">
                <ul>
                    <li><a href="<?php echo site_url().'/product/'?>">Product</a></li>
                    <li><a href="<?php echo site_url().'/brand/'?>">Brand</a></li>
                    <li><a href="#">Advertiment</a></li>
                    <li><a href="#"></a></li>
                </ul>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <div id="middle">
    	<div id="middleWrap" class="container_24">
        	<h1><a href="#">Product Management</a> &raquo; Update Product</h1>
            <div id="productAddNew" class="product booForm">
            <form id="frm" name="frm" action="" method="post">
                <input type="hidden" id="action" name="action" value="" />
                <div class="grid_16">
                    <div class="grid_8 alpha">
                        <div class="formItem text">
                            <div class="grid_2 alpha"><label for="pName">Name:</label></div>
                            <div class="grid_6 omega"><input type="text" class="large" id="pName" name="pName" value="" /></div>
                            <div class="clear"></div>
                        </div>
                        <div class="formItem text">
                            <div class="grid_2 alpha"><label for="pCode">Code:</label></div>
                            <div class="grid_6 omega"><input type="text" class="medium" id="pCode" name="pCode" value="" /></div>
                            <div class="clear"></div>
                        </div>
                        <div class="formItem text">
                            <div class="grid_2 alpha"><label for="pDate">Date:</label></div>
                            <div class="grid_6 omega"><input type="text" class="medium" id="pDate" name="pDate" value="<?php echo date('Y-m-d',time());?>" /></div>
                            <div class="clear"></div>
                        </div>
                        <div class="formItem text">
                            <div class="grid_2 alpha"><label for="pMaterial">Material:</label></div>
                            <div class="grid_6 omega"><input type="text" class="medium" id="pMaterial" name="pMaterial" value="" /></div>
                            <div class="clear"></div>
                        </div>
                        <div class="formItem text">
                            <div class="grid_2 alpha"><label for="pColor">Color:</label></div>
                            <div class="grid_6 omega"><input type="text" class="medium" id="pColor" name="pColor" value="" /></div>
                            <div class="clear"></div>
                        </div>
                        <div class="formItem text">
                            <div class="grid_2 alpha"><label for="pColorImg">Color Img:</label></div>
                            <div class="grid_6 omega"><input type="text" class="medium" id="pColorImg" name="pColorImg" value="" /></div>
                            <div class="clear"></div>
                        </div>
                        <div class="formItem text">
                            <div class="grid_2 alpha"><label for="pPrice">Price:</label></div>
                            <div class="grid_6 omega"><input type="text" class="medium" id="pPrice" name="pPrice" value="" /></div>
                            <div class="clear"></div>
                        </div>
                        
                    </div>
                    <div class="grid_8 omega">
                        <div class="formItem checkbox">
                            <div class="grid_2 alpha"><label for="pSize">Size:</label></div>
                            <div class="grid_6 omega">
                            <?php 
                                $strSize =(isset($productInfo->size)) ?  $productInfo->size : "";
                                $arrSize = explode(',',$strSize);
                            ?>
                            <?php foreach($arrSizeChar as $sizeChar): ?>
                                <?php echo $sizeChar; ?><input type="checkbox" name="pSize[]" value="<?php echo $sizeChar; ?>" />&nbsp;
                            <?php endforeach; ?>
                            <br />
                            <?php foreach($arrSizeNumber as $sizeNumber): ?>
                                <?php echo $sizeNumber; ?><input type="checkbox" name="pSize[]" value="<?php echo $sizeNumber;?>" />&nbsp;
                            <?php endforeach; ?>
                            </div>
                            <div class="clear"></div>
                        </div>
                        
                        <div class="formItem optionbox">
                            <div class="grid_2 alpha"><label for="pStatus">Show:</label></div>
                            <div class="grid_6 omega">
                                Yes<input type="radio" id="pStatus" name="pStatus" value="1" checked="checked" />&nbsp;
                                No<input type="radio" id="pStatus" name="pStatus" value="0" /> </div>
                            <div class="clear"></div>
                        </div>
                        <div class="formItem optionbox">
                            <div class="grid_2 alpha"><label for="pIsHome">Is home:</label></div>
                            <div class="grid_6 omega">Yes<input type="radio" id="pIsHome" name="pIsHome" value="1" />&nbsp;
                                No<input type="radio" id="pIsHome" name="pIsHome" value="0" checked="checked" /></div>
                            <div class="clear"></div>
                        </div>
                        <div class="formItem optionbox">
                            <div class="grid_2 alpha"><label for="pIsHot">Is hot:</label></div>
                            <div class="grid_6 omega">Yes<input type="radio" id="pIsHot" name="pIsHot" value="1" />&nbsp;
                                No<input type="radio" id="pIsHot" name="pIsHot" value="0" checked="checked" /></div>
                            <div class="clear"></div>
                        </div>
                        <div class="formItem optionbox">
                            <div class="grid_2 alpha"><label for="pIsSale">Is sale:</label></div>
                            <div class="grid_6 omega">Yes<input type="radio" id="pIsSale" name="pIsSale" value="1" />&nbsp;
                                No<input type="radio" id="pIsSale" name="pIsSale" value="0" checked="checked" />
                            </div>
                            <div class="clear"></div>
                            <div class="grid_2 alpha"><label>Type:</label></div>
                            <div class="grid_2"> <input class="small" type="text" id="pSaleType" name="pSaleType" value="percent" /></div>
                            <div class="grid_2 alpha"><label>Value:</label></div>
                            <div class="grid_2 omega"><input class="small" type="text" id="pSaleValue" name="pSaleValue" value="0" /></div>
                            <div class="clear"></div>
                        </div>
                        
                    </div>
                    <div class="clear"></div>
                    <div class="formItem text">
                        <div class="grid_2 alpha"><label for="pPicture">Pictures:</label></div>
                        <div class="grid_13 omega"><input type="text" class="superLarge required" id="pPictures" name="pPictures" value="" /></div>
                        <div class="clear"></div>
                    </div>
                    <div id="descriptionWrap" class="formItem">
                    <h3>Description:</h3>
                    	<textarea id="pDes" name="pDes"></textarea>
                    </div>
                </div>
                <div class="grid_8">
                	<div class="formItem listbox">
                        <label class="alignLeft">Category</label>
                        <select id="pCatCode" name="pCatCode" size="10">
                        <!-- 
                        -- option's value will be fixed as product category code 
                        -- pcat_code & pcat_name are in product_category table.
                        -- Male or Memale can be retrieve in the first segment
                        -- of pcat_code
                        -- There's a blank value for no-category product.
                        -------------------------------------------------------->
                            <option value="---" selected="selected">Other</option>
                            <?php
                                foreach ($categoryGroups as $catGroupCode => $catGroupName) :
                                    $codeName = 'categories'.$catGroupCode;
                            ?>
                            <optgroup label="<?php echo $catGroupName; ?>">
                                <?php foreach($$codeName as $category) : ?>    
                                    <option value="<?php echo $category->pcat_code; ?>">
                                        <?php echo $category->pcat_name; ?>
                                    </option> 
                                <?php endforeach; ?>
                            </optgroup>
                            <?php endforeach; ?>
                        </select>
                    </div>
                    <div class="formItem listbox">
                        <label class="alignLeft">Brand</label>
                        <select id="pBrand" name="pBrand" size="10">
                        <!-- 
                        -- option's value will be fixed as product brand code 
                        -- brand_code & brand_name are in brand table.
                        -- There's a blank value for no-brand product
                        -------------------------------------------------------->
                        <option value="---" selected="selected">Other</option>
                        <?php echo $productInfo->brandcode; ?>
                            <?php foreach($brands as $brand) : ?>
                            <option value="<?php echo $brand->brand_alias; ?>">
                                <?php echo $brand->brand_name; ?>
                            </option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                </div>
                <div class="clear"></div>
            </form>    
            </div>
            <div class="actionBar product">
            	<div class="actionMenu grid_19">
            	<ul>
                    <li><a id="btnSave" class="btnSubmit" href="#" title="Save &amp; Add">Save &amp; Add another</a></li>
                    <li><a id="btnSaveBack" class="btnSubmit" href="#" title ="Save &amp; Go back">Save &amp; Go back</a></li>
                    <li><a id="btnBack" href="<?php echo site_url()."/product/index/"; ?>">Go back</a></li>
                    
                </ul>
                </div>
                <div class="pagination grid_5">
                &nbsp;<strong>1</strong>&nbsp;<a href="index.php/product/index/20">2</a>&nbsp;<a href="index.php/product/index/40">3</a>&nbsp;<a href="index.php/product/index/20">&gt;</a>&nbsp;&nbsp;<a href="index.php/product/index/620">Last ›</a></div>
            </div>
        </div>
    </div>
    <div id="bottom">
    	<div class="threeCol"></div>
        <div class="threeCol"></div>
        <div class="threeCol"></div>
        <div class="clear"></div>
    </div>
</div>

<!-- Tiny MCE -->


<!-- Date picker -->
<script type="text/javascript">
	$('#pDate').DatePicker({
		format:'Y-m-d',
		date: $('#pDate').val(),
		current: $('#pDate').val(),
		starts: 1,
		position: 'r',
		onBeforeShow: function(){
				$('#pDate').DatePickerSetDate($('#pDate').val(), true);
		},
		onChange: function(formated, dates){
				$('#pDate').val(formated);
				//if ($('#closeOnSelect input').attr('checked')) {
						$('#pDate').DatePickerHide();
				//}
		}
	});
</script>
<script type="text/javascript">
/*
* 
*/
    $("#pName").focus();
    $(".btnSubmit").click(function(){
        $("#action").val($(this).attr('id'));
        $("#frm").submit();
    });
</script>
</body>
</html>
<?php else : redirect('gafs/index/'); ?>

<?php endif; ?>